﻿using MaterialDesignThemes.Wpf;
using Prism.Commands;
using Prism.Mvvm;
using Prism.Services.Dialogs;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using 基于WPF的电缆采样数据分析系统.Service;

namespace 基于WPF的电缆采样数据分析系统.ViewModels.TDRWork.MenuPage
{
    public class DeletePageUCViewModel : BindableBase, IDialogHostAware
    {

        // 主机名
        private const string DialogHostName = "RootDialog";

        #region 确定
        /// <summary>
        /// 确定命令
        /// </summary>
        public DelegateCommand SaveCommand { get; set; }

        /// <summary>
        /// 确定方法
        /// </summary>
        private void SaveFun()
        {
            if (DialogHost.IsDialogOpen(DialogHostName))
            {
                DialogHost.Close(DialogHostName, new DialogResult(ButtonResult.Yes));
            }
        }
        #endregion

        #region 取消
        /// <summary>
        /// 取消命令
        /// </summary>
        public DelegateCommand CancelCommand { get; set; }

        /// <summary>
        /// 取消方法
        /// </summary>
        private void CancelFun()
        {
            if (DialogHost.IsDialogOpen(DialogHostName))
            {
                DialogHost.Close(DialogHostName, new DialogResult(ButtonResult.No));
            }
        }
        #endregion

        /// <summary>
        /// 打开过程中
        /// </summary>
        /// <param name="parameters"></param>
        public void OnDialogOpening(IDialogParameters parameters)
        {
            PageTitle = parameters.GetValue<string>("Title");
            PageContent = parameters.GetValue<string>("Content");
        }

        /// <summary>
        /// 构造器
        /// </summary>
        public DeletePageUCViewModel()
        {
            //绑定确定和取消命令
            SaveCommand = new DelegateCommand(SaveFun);
            CancelCommand = new DelegateCommand(CancelFun);
        }

        #region 页面信息
        /// <summary>
        /// 标题
        /// </summary>
        private string _PageTitle;

        /// <summary>
        /// 标题
        /// </summary>
        public string PageTitle
        {
            get { return _PageTitle; }
            set
            {
                _PageTitle = value;
                RaisePropertyChanged();
            }
        }

        /// <summary>
        /// 内容
        /// </summary>
        private string _PageContent;

        /// <summary>
        /// 内容
        /// </summary>
        public string PageContent
        {
            get { return _PageContent; }
            set
            {
                _PageContent = value;
                RaisePropertyChanged();
            }
        }


        #endregion
    }
}
